package com.xunlai.infra.permission.business.dao.entity;

import com.xunlai.infra.permission.storage.entity.BaseEntity;
import lombok.*;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author liang
 * @date 9/5/23 4:40 PM
 */
@Table("travel_order")
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Order extends BaseEntity implements Serializable {

    @Serial
    private static final long serialVersionUID = 7984782779666999160L;

    @Id
    private Long id;

    private String orderNo;

    private Long customerId;

    /**
     * 商品总金额
     */
    private BigDecimal totalGoodsAmount;

    /**
     * 实际支付金额
     */
    private BigDecimal totalPayAmount;

    /**
     * 优惠金额
     */
    private BigDecimal totalDiscount;

    /**
     * 下单时间
     */
    private LocalDateTime orderTime;

    private Integer status;

    private LocalDateTime payTime;



    public enum OrderStatus {
        CREATE(0),
        PAID(1),
        COMPLETE(2)
        ;
        private final int status;

        OrderStatus(int status) {
            this.status = status;
        }

        public int getStatus() {
            return status;
        }
    }
}
